<!--
 @Author: libing/makeup1122
 @Email: makeup1123@163.com
 @Date: "2020-02-28 22:20:06"
-->
<template>
  <div>
    <van-row type='flex' justify='center'>
      <van-col>
        <van-image
          round
          width="4rem"
          height="4rem"
          :src="avatar"
        />
      </van-col>
    </van-row>
    <van-row type='flex' justify='center'>
      <van-col>
        {{name}}
      </van-col>
    </van-row>
    <van-row style="margin: 20px 0px">
      <van-cell-group>
        <van-cell title="个人信息" is-link :to="{ name: 'UserProfile' }"/>
      </van-cell-group>
    </van-row>
    <van-row>
      <van-col :span="24">
        <van-button block type="danger" @click="logout">退出</van-button>
      </van-col>
    </van-row>
  </div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
  name: 'UserHome',
  components: {},
  data: function () {
    return {
    }
  },
  created: function () {
  },
  computed: {
    ...mapGetters([
      'name',
      'avatar'
    ])
  },
  methods: {
    logout: function() {
      this.$store.dispatch('doLogout').then(() => {
        this.$router.push({ name: 'Home' })
      })
    }
  }
}
</script>
<style scoped>
</style>
